package stream.Demo10;

import java.io.FileWriter;

/**
 * @Author Miku
 * @Create 2021/4/30 10:02
 * 使用FileWriter写入文件
 */
public class Test {
    public static void main(String[] args) throws Exception {
        //1.创建FileWriter对象
        FileWriter fw = new FileWriter("e:\\write.txt");
        //2.写入
        for (int i = 0; i< 10; i++) {
            fw.write("test\n");
            fw.flush();
        }
        //3.关闭
        fw.close();
        System.out.println("执行完毕");
    }
}
